\begin{hcarentry}{2LT: Two-Level Transformation}
\label{2lt}
\report{Tiago Miguel Laureano Alves}%11/08
\participants{Joost Visser, Pablo Berdaguer, Alcino Cunha, Jos\'e Nuno Oliveira, Hugo Pacheco}
\status{active}
\makeheader

A two-level data transformation consists of a type-level transformation of a
data format coupled with value-level transformations of data instances
corresponding to that format. Examples of two-level data transformations
include XML schema evolution coupled with document migration, and data mappings
used for interoperability and persistence.

In the 2LT project, support for two-level transformations is being developed
using Haskell, relying in particular on generalized abstract data types
(GADTs). Currently, the 2LT package offers:
\begin{itemize}
\item
A library of two-level transformation combinators. These combinators are used
to compose transformation systems which, when applied to an input type,
produce an output type together with the conversion functions that mediate
between input and output types. 

\item
Front-ends for VDM-SL, XML, and SQL. These front-ends support (i)~reading a
schema, (ii)~applying a two-level transformation system to produce a new
schema, (iii)~converting a document/database corresponding to the input schema to
a document/database corresponding to the output schema, and \emph{vice versa}.

\item
A combinator library for transformation of point-free and structure-shy
functions. These combinators are used to compose transformation systems for
optimization of conversion functions, and for migration of queries through
two-level transformations. Independently of two-level transformation, the
combinators can be used to specialize structure-shy programs (such as XPath
queries and strategic functions) to structure-sensitive point-free form, and
\emph{vice versa}.

\item
Support for schema constraints using point-free expressions. Constraints
present in the initial schema are preserved during the transformation process
and new constraints are added in specific transformations to ensure semantic
preservation. Constraints can be simplified using the already existent library
for transformation of point-free functions.
\end{itemize}
The various sets of transformation combinators are reminiscent of the
combinators of Strafunski and the Scrap-your-Boilerplate~\cref{syb} approach to generic
functional programming.

A release of 2LT is available from the project URL.

\FuturePlans
New functionality is planned, such as elaboration of the front-ends and the creation of a web
interface.
Furthermore, efforts are underway to reimplement the existent functionality using lenses under the context of the PhD student Hugo Pacheco.

\FurtherReading
\begin{compactitem}
\item
Project URL: \url{http://2lt.googlecode.com}

\item
Alcino Cunha, Jos\'e Nuno Oliveira, Joost Visser. \emph{Type-safe Two-level
Data Transformation}. Formal Methods 2006.

\item
Alcino Cunha, Joost Visser. Strongly Typed Rewriting For Coupled Software
Transformation. RULE 2006.

\item
Pablo Berdaguer, Alcino Cunha, Hugo Pacheco, Joost Visser. \emph{Coupled
Schema Transformation and Data Conversion For XML and SQL}. PADL 2007.

\item
Alcino Cunha and Joost Visser. \emph{Transformation of Structure-Shy Programs,
Applied to XPath Queries and Strategic Functions}. PEPM 2007.

\item
Tiago L. Alves, Paulo Silva and Joost Visser. \emph{Constraint-aware Schema
Transformation}. RULE, 2008.
\end{compactitem}
\end{hcarentry}
